﻿@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_Index.cshtml";
}
<script>
    $(function () {
        gridList();
    })
    function gridList() {
        var $gridList = $("#gridList");
        $gridList.dataGrid({
            url: "/SiteManage/Space/GetGridJson",
            height: $(window).height() - 96,
            colModel: [
                { label: '空间名称', name: 'title', width: 200, align: 'left' },
                { label: '价格单位', name: 'units', width: 200, align: 'left' },
                { label: '落位区域', name: 'through_three_areas', width: 200, align: 'left' },
                { label: '最大容纳人数', name: 'max_seating_capacity', width: 200, align: 'left' },
                { label: '可使用面积', name: 'area', width: 200, align: 'left' },
                { label: '层高', name: 'height', width: 200, align: 'left' },
                { label: '状态', name: 'state', width: 200, align: 'left' },
                { label: '订金收取方式', name: 'F_Subscription_Type', width: 200, align: 'left' },
                { label: '订金', name: 'F_Subscription_Price', width: 200, align: 'left' },
               
                {
                    label: '更新时间', name: 'F_LastModifyTime', width: 120, align: 'left',
                    formatter: "date", formatoptions: { srcformat: 'Y-m-d H:i:s', newformat: 'Y-m-d H:i:s' }
                }, //{ label: '', name: 'audit_people', width: 200, align: 'left' },
                //{
                //    label: '创建时间', name: 'F_CreatorTime', width: 120, align: 'left',
                //    formatter: "date", formatoptions: { srcformat: 'Y-m-d H:i:s', newformat: 'Y-m-d H:i:s' }
                //},
                //{ label: '介绍', name: 'introduced', width: 200, align: 'left' },
                //{ label: '预订须知', name: 'booking_notes', width: 200, align: 'left' },
                //{ label: '', name: 'creation_people', width: 200, align: 'left' },
                //{ label: '地面称重Kg', name: 'accept_weight', width: 200, align: 'left' },
                //{ label: '联系人', name: 'contact', width: 200, align: 'left' },
                //{ label: '手机号', name: 'phone', width: 200, align: 'left' },
                //{ label: '座机', name: 'telephone', width: 200, align: 'left' },
                //{ label: '邮箱', name: 'email', width: 200, align: 'left' },
                //{ label: '联系人职位', name: 'contact_position', width: 200, align: 'left' },
                //{ label: '场地刊例价', name: 'market_price', width: 200, align: 'left' },
                //{ label: '场地Yunspace价', name: 'inner_price', width: 200, align: 'left' },
                //{ label: '场地低价', name: 'floor_price', width: 200, align: 'left' },
                //{ label: '场景品牌价格', name: 'brand_price', width: 200, align: 'left' },
                //{ label: '可搭建高度', name: 'limit_height', width: 200, align: 'left' },
                //{ label: '长宽秀场必填', name: 'length_width', width: 200, align: 'left' },
                //{ label: '所处楼层', name: 'current_floor', width: 200, align: 'left' },
                //{ label: '空间吊顶Kg', name: 'ceiling', width: 200, align: 'left' },
                //{ label: '供电量千瓦', name: 'power_supply', width: 200, align: 'left' },
                //{ label: '网络兆', name: 'network', width: 200, align: 'left' },
                //{ label: '可否进车', name: 'vehicle', width: 200, align: 'left' },
                //{ label: '搭建日Yunspace价', name: 'price_build', width: 200, align: 'left' },
                //{ label: '通宵搭建Yunspace价', name: 'price_night_build', width: 200, align: 'left' },
                //{ label: '进场押金', name: 'deposit', width: 200, align: 'left' },
                //{ label: '能耗说明', name: 'property_fee', width: 200, align: 'left' },
                //{ label: '价格是否含税', name: 'quote_explain', width: 200, align: 'left' },
                //{ label: '发票类型', name: 'invoice', width: 200, align: 'left' },
                //{ label: '税点', name: 'invoice_tax', width: 200, align: 'left' },
                //{ label: '本月推广价格', name: 'c_month_price', width: 200, align: 'left' },
                //{ label: '新合作价格', name: 'new_cooperation_price', width: 200, align: 'left' },
                //{ label: '专题价格', name: 'special_price', width: 200, align: 'left' },
                //{ label: '利润率', name: 'porfit_rate', width: 200, align: 'left' },
                //{ label: '活动现场禁忌', name: 'remark', width: 200, align: 'left' },
                //{ label: '搭建日市场刊例价', name: 'price_market_build', width: 200, align: 'left' },
                //{ label: '搭建日低价', name: 'price_floor_build', width: 200, align: 'left' },
                //{ label: '通宵搭建市场刊例价', name: 'price_night_market_build', width: 200, align: 'left' },
                //{ label: '通宵搭建低价', name: 'price_night_floor_build', width: 200, align: 'left' },
                //{ label: '进出口限高', name: 'exit_limit', width: 200, align: 'left' },
                //{ label: '空间类型', name: 'space_type', width: 200, align: 'left' },
                { label: '', name: 'F_Id', hidden: true },
                { label: '', name: 'F_SiteId', hidden: true }
                //{
                //    label: '示例', name: 'SampleAttr', width: 230, align: 'left',
                //    formatter: function (cellvalue, options, rowObject) {
                //        return cellvalue + ";" + rowObject.F_IPAddressName;
                //    }
                //}
            ],
            pager: "#gridPager",
            sortname: 'F_Id desc',
            viewrecords: true
        });
        $("#btn_search").click(function () {
            var queryJsonSearch = {
                keyword: $("#txt_keyword").val()
            }
            $gridList.jqGrid('setGridParam', {
                postData: { queryJson: JSON.stringify(queryJsonSearch) },
            }).trigger('reloadGrid');
        });
    }
    function btn_add() {
        $.modalOpen({
            id: "Form",
            title: "新增空间信息",
            url: "/SiteManage/Space/Form",
            width: "1000px",
            height: "720px",
            callBack: function (iframeId) {
                top.frames[iframeId].submitForm();
            }
        });
    }

    function btn_edit() {
        var keyValue = $("#gridList").jqGridRowValue().F_Id;
        $.modalOpen({
            id: "Form",
            title: "修改空间信息",
            url: "/SiteManage/Price/Form?spaceId=" + keyValue + "&F_SiteId=" + $("#gridList").jqGridRowValue().F_SiteId,
            width: "1000px",
            height: "720px",
            callBack: function (iframeId) {
                top.frames[iframeId].submitForm();
            }
        });
    }
    function btn_delete() {
        $.deleteForm({
            url: "/SiteManage/Space/DeleteForm",
            param: { keyValue: $("#gridList").jqGridRowValue().F_Id },
            success: function () {
                $.currentWindow().$("#gridList").trigger("reloadGrid");
            }
        })
    }
    function btn_schedule() {
        var keyValue = $("#gridList").jqGridRowValue().F_Id;
        var SiteId = $("#gridList").jqGridRowValue().F_SiteId;
        console.log(JSON.stringify($("#gridList").jqGridRowValue()))
        $.modalOpen({
            id: "schedule",
            title: "修改空间档期",
            url: "/SiteManage/Space/Schedule?keyValue=" + keyValue + "&SiteId=" + SiteId,
            width: "1000px",
            height: "720px",
            callBack: function (iframeId) {
                top.frames[iframeId].submitForm();
            }
        });
    }
    function btn_editServer() {
        var keyValue = $("#gridList").jqGridRowValue().F_Id;
        $.modalOpen({
            id: keyValue,
            title: "修改增值服务",
            url: "/SiteManage/ServicesCost/Index?spaceId=" + keyValue + "&F_SiteId=" + $("#gridList").jqGridRowValue().F_SiteId,
            width: "1200px",
            height: "720px",
            callBack: function (iframeId) {
                top.frames[iframeId].submitForm();
            }
        });
    }
</script>

<div class="topPanel">
    <div class="toolbar">
        <div class="btn-group">
            <a class="btn btn-primary" onclick="$.reload()"><span class="glyphicon glyphicon-refresh"></span></a>
        </div>
        <div class="btn-group">
            <a id="NF-add" authorize="yes" class="btn btn-primary dropdown-text" onclick="btn_add()"><i class="fa fa-eraser"></i>添加空间</a>
        </div>
        <div class="operate">
            <ul class="nav nav-pills">
                <li class="first">已选中<span>1</span>项</li>
                <li><a id="NF-edit" authorize="yes" onclick="btn_edit()"><i class="fa fa-pencil-square-o"></i>修改空间</a></li>
                <li><a id="NF-delete" authorize="yes" onclick="btn_delete()"><i class="fa fa-trash-o"></i>删除空间</a></li>
                <li><a id="NF-Server" authorize="yes" onclick="btn_editServer()"><i class="fa fa-pencil-square-o"></i>增值服务</a></li>
                <li><a id="NF-schedule" authorize="yes" onclick="btn_schedule()"><i class="fa fa-pencil-square-o"></i>档期管理</a></li>
            </ul>
            <a href="javascript:;" class="close"></a>
        </div>
        <script>$('.toolbar').authorizeButton()</script>
    </div>
    <div class="search">
        <table>
            <tr>
                <td>
                    <div class="input-group">
                        <input id="txt_keyword" type="text" class="form-control" placeholder="请输入要查询关键字" style="width: 200px;">
                        <span class="input-group-btn">
                            <button id="btn_search" type="button" class="btn  btn-primary"><i class="fa fa-search"></i></button>
                        </span>
                    </div>
                </td>
            </tr>
        </table>
    </div>
</div>

<div class="gridPanel">
    <table id="gridList"></table>
    <div id="gridPager"></div>
</div>


